package cn.xuchunh.tiq.ui;

import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import cn.xuchunh.tiq.R;
import cn.xuchunh.tiq.ui.QueryFragment;
import cn.xuchunh.tiq.ui.ResultFragment;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.add(R.id.container, new QueryFragment());
        ft.commit();
    }

    public void showResult(String content) {
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.add(R.id.container, ResultFragment.newInstance(content));
        ft.addToBackStack(null);
        ft.commit();
    }
}
